﻿<%@ Page Title="Customer" Language="C#" MasterPageFile="~/TableMaster.master" AutoEventWireup="true" CodeFile="Clients.aspx.cs" Inherits="admin_Clients" %>

<asp:Content ID="headerContent" ContentPlaceHolderID="head" runat="Server">
    <style>
        td input {
            width: 80%;
            max-width: 300px;
        }

        td textarea {
            width: 80%;
            max-width: 300px;
        }
    </style>

    <style>
        @media only screen and (max-width: 760px), (min-device-width: 768px) and (max-device-width: 1024px) {

            .resTbl tr:nth-of-type(odd) {
                background-color: #CDE2FF;
            }

            .resTbl tr:nth-of-type(1) {
                display: none;
            }

            .resTbl td:nth-of-type(1):before {
                content: "User Code";
            }

            .resTbl td:nth-of-type(2):before {
                content: "Company Name";
            }

            .resTbl td:nth-of-type(3):before {
                content: "Company Address";
            }

            .resTbl td:nth-of-type(4):before {
                content: "Country";
            }

            .resTbl td:nth-of-type(5):before {
                content: "State";
            }

            .resTbl td:nth-of-type(6):before {
                content: "City";
            }

            .resTbl td:nth-of-type(7):before {
                content: "Postal Code";
            }

            .resTbl td:nth-of-type(8):before {
                content: "Primary Telephone";
            }

            .resTbl td:nth-of-type(9):before {
                content: "Secondary Telephone";
            }

            .resTbl td:nth-of-type(10):before {
                content: "Primary Mobile";
            }

            .resTbl td:nth-of-type(11):before {
                content: "Secondary Mobile";
            }

            .resTbl td:nth-of-type(12):before {
                content: "Email";
            }

            .resTbl td:nth-of-type(13):before {
                content: "Agreement Document";
            }

            .resTbl td:nth-of-type(14):before {
                content: "Link To ISF";
            }

            .resTbl td:nth-of-type(15):before {
                content: "FAX";
            }

            .resTbl td:nth-of-type(16):before {
                content: "LinkedIn ID";
            }

            .resTbl td:nth-of-type(17):before {
                content: "Skype ID";
            }

            .resTbl td:nth-of-type(18):before {
                content: "VAT Tax ID";
            }

            .resTbl td:nth-of-type(19):before {
                content: "Active";
            }
        }
    </style>

    <script>
        function toggleUploader(fu,btn) {
            $('#' + fu).toggle();
            if ($('#' + fu).is(":visible"))
                $(btn).val('Cancel');
            else
                $(btn).val('Replace');
        }
    </script>

</asp:Content>

<asp:Content ID="Content1" ContentPlaceHolderID="FeaturedContent" runat="Server">
</asp:Content>


<asp:Content ID="Content2" ContentPlaceHolderID="Add" runat="Server">



    <asp:Panel ID="pnlAdd" runat="server">

        <table cellpadding="0" cellspacing="0" style="width: 100%;">

            <tr>
                <td style="width: 170px">
                    <asp:Label ID="lblUSER_CODE" runat="server" AssociatedControlID="txtUSER_CODE" Text="Customer Code:"></asp:Label>
                </td>
                <td>
                    <asp:TextBox ID="txtUSER_CODE" runat="server"></asp:TextBox>
                </td>
            </tr>

            <tr>
                <td style="width: 170px">
                    <asp:Label ID="lblCOMPANY_NAME" runat="server" AssociatedControlID="txtCOMPANY_NAME" Text="Company Name:"></asp:Label>
                </td>
                <td>
                    <asp:TextBox ID="txtCOMPANY_NAME" runat="server"></asp:TextBox>
                </td>
            </tr>

            <tr>
                <td style="width: 170px">
                    <asp:Label ID="lblCOMPANY_ADDRESS" runat="server" AssociatedControlID="txtCOMPANY_ADDRESS" Text="Company Address:"></asp:Label>
                </td>
                <td>
                    <asp:TextBox ID="txtCOMPANY_ADDRESS" runat="server"></asp:TextBox>
                </td>
            </tr>

            <tr>
                <td style="width: 170px">
                    <asp:Label ID="lblCountry" runat="server" AssociatedControlID="ddlCountry" Text="Country:"></asp:Label>
                </td>
                <td>
                    <asp:DropDownList ID="ddlCountry" runat="server" AutoPostBack="True" DataSourceID="DS_Countries" DataTextField="Country" DataValueField="Country" AppendDataBoundItems="True" OnSelectedIndexChanged="ddlCountry_SelectedIndexChanged">
                        <asp:ListItem Text="--Select--" Value="0"></asp:ListItem>
                    </asp:DropDownList>
                    <asp:ObjectDataSource ID="DS_Countries" runat="server" SelectMethod="selectCountry" TypeName="DAL_tbl_countrystatemapping"></asp:ObjectDataSource>
                </td>
            </tr>

            <tr>
                <td style="width: 170px">
                    <asp:Label ID="lblSTATE" runat="server" AssociatedControlID="ddlSTATE" Text="State:"></asp:Label>
                </td>
                <td>
                    <asp:DropDownList ID="ddlSTATE" runat="server" AutoPostBack="True" DataSourceID="DS_States" DataTextField="State" DataValueField="State" AppendDataBoundItems="True" OnSelectedIndexChanged="ddlSTATE_SelectedIndexChanged">
                        <asp:ListItem Text="--Select--" Value="0"></asp:ListItem>
                    </asp:DropDownList>
                    <asp:ObjectDataSource ID="DS_States" runat="server" SelectMethod="selectState" TypeName="DAL_tbl_countrystatemapping">
                        <SelectParameters>
                            <asp:ControlParameter ControlID="ddlCountry" DefaultValue="0" Name="country" PropertyName="SelectedValue" Type="String" />
                        </SelectParameters>
                    </asp:ObjectDataSource>
                </td>
            </tr>

            <tr>
                <td style="width: 170px">
                    <asp:Label ID="lblCITY" runat="server" AssociatedControlID="ddlCITY" Text="City:"></asp:Label>
                </td>
                <td>
                    <asp:DropDownList ID="ddlCITY" runat="server" DataSourceID="DS_Cities" DataTextField="City" DataValueField="City" AppendDataBoundItems="True">
                        <asp:ListItem Text="--Select--" Value="0"></asp:ListItem>
                    </asp:DropDownList>
                    <asp:ObjectDataSource ID="DS_Cities" runat="server" SelectMethod="selectCity" TypeName="DAL_tbl_countrystatemapping">
                        <SelectParameters>
                            <asp:ControlParameter ControlID="ddlCountry" DefaultValue="0" Name="country" PropertyName="SelectedValue" Type="String" />
                            <asp:ControlParameter ControlID="ddlSTATE" DefaultValue="0" Name="state" PropertyName="SelectedValue" Type="String" />
                        </SelectParameters>
                    </asp:ObjectDataSource>
                </td>
            </tr>

            <tr>
                <td style="width: 170px">
                    <asp:Label ID="lblPOSTAL_CODE" runat="server" AssociatedControlID="txtPOSTAL_CODE" Text="Postal Code:"></asp:Label>
                </td>
                <td>
                    <asp:TextBox ID="txtPOSTAL_CODE" runat="server"></asp:TextBox>
                </td>
            </tr>

            <tr>
                <td style="width: 170px">
                    <asp:Label ID="lblPRIMARY_TELEPHONE" runat="server" AssociatedControlID="txtPRIMARY_TELEPHONE" Text="Primary Telephone:"></asp:Label>
                </td>
                <td>
                    <asp:TextBox ID="txtPRIMARY_TELEPHONE" runat="server"></asp:TextBox>
                </td>
            </tr>

            <tr>
                <td style="width: 170px">
                    <asp:Label ID="lblSECONDARY_TELEPHONE" runat="server" AssociatedControlID="txtSECONDARY_TELEPHONE" Text="Secondary Telephone:"></asp:Label>
                </td>
                <td>
                    <asp:TextBox ID="txtSECONDARY_TELEPHONE" runat="server"></asp:TextBox>
                </td>
            </tr>

            <tr>
                <td style="width: 170px">
                    <asp:Label ID="lblPRIMARY_MOBILE" runat="server" AssociatedControlID="txtPRIMARY_MOBILE" Text="Primary Mobile:"></asp:Label>
                </td>
                <td>
                    <asp:TextBox ID="txtPRIMARY_MOBILE" runat="server"></asp:TextBox>
                </td>
            </tr>

            <tr>
                <td style="width: 170px">
                    <asp:Label ID="lblSECONDARY_MOBILE" runat="server" AssociatedControlID="txtSECONDARY_MOBILE" Text="Secondary Mobile:"></asp:Label>
                </td>
                <td>
                    <asp:TextBox ID="txtSECONDARY_MOBILE" runat="server"></asp:TextBox>
                </td>
            </tr>

            <!--/////////////////////////////////////////////////////////////////////-->
            <tr>
                <td style="width: 170px">
                    <asp:Label ID="lblEmail" runat="server" AssociatedControlID="txtEmail" Text="Email:"></asp:Label>
                </td>
                <td>
                    <asp:TextBox ID="txtEmail" runat="server"></asp:TextBox>
                </td>
            </tr>

            <tr>
                <td style="width: 170px">
                    <asp:Label ID="lblAgreement_Document" runat="server" AssociatedControlID="txtAgreement_Document" Text="Agreement Document:"></asp:Label>
                </td>
                <td>
                    <asp:FileUpload ID="fuAgreement_Document" runat="server" />
                    <asp:Label ID="txtAgreement_Document" runat="server" style="display:none;" ></asp:Label>
                    <asp:Button ID="btnRemoveAgreement" runat="server" Text="Replace" style="display:none;" OnClientClick="toggleUploader('MainContent_Add_fuAgreement_Document', this);return false;" ToolTip="Replace Agreement" Width="80px" />
                </td>
            </tr>

            <tr>
                <td style="width: 170px">
                    <asp:Label ID="lblLink_To_ISF" runat="server" AssociatedControlID="txtLink_To_ISF" Text="Link To ISF:"></asp:Label>
                </td>
                <td>
                    <asp:FileUpload ID="fuLink_To_ISF" runat="server" />
                    <asp:Label ID="txtLink_To_ISF" runat="server" style="display:none;" ></asp:Label>
                    <asp:Button ID="btnRemoveISF" runat="server" Text="Replace" style="display:none;" OnClientClick="toggleUploader('MainContent_Add_fuLink_To_ISF', this);return false;" ToolTip="Replace ISF" Width="80px" />
                </td>
            </tr>

            <tr>
                <td style="width: 170px">
                    <asp:Label ID="lblFAX" runat="server" AssociatedControlID="txtFAX" Text="FAX:"></asp:Label>
                </td>
                <td>
                    <asp:TextBox ID="txtFAX" runat="server"></asp:TextBox>
                </td>
            </tr>

            <tr>
                <td style="width: 170px">
                    <asp:Label ID="lblLinkedIn_ID" runat="server" AssociatedControlID="txtLinkedIn_ID" Text="LinkedIn ID:"></asp:Label>
                </td>
                <td>
                    <asp:TextBox ID="txtLinkedIn_ID" runat="server"></asp:TextBox>
                </td>
            </tr>

            <tr>
                <td style="width: 170px">
                    <asp:Label ID="lblSkype_ID" runat="server" AssociatedControlID="txtSkype_ID" Text="Skype ID:"></asp:Label>
                </td>
                <td>
                    <asp:TextBox ID="txtSkype_ID" runat="server"></asp:TextBox>
                </td>
            </tr>

            <tr>
                <td style="width: 170px">
                    <asp:Label ID="lblVAT_Tax_ID" runat="server" AssociatedControlID="txtVAT_Tax_ID" Text="VAT Tax ID:"></asp:Label>
                </td>
                <td>
                    <asp:TextBox ID="txtVAT_Tax_ID" runat="server"></asp:TextBox>
                </td>
            </tr>
            <!--/////////////////////////////////////////////////////////////////////-->

            <tr>
                <td style="width: 170px">
                    <asp:Label ID="lblActive" runat="server" AssociatedControlID="chkActive" Text="Active:"></asp:Label>
                </td>
                <td>
                    <asp:CheckBox ID="chkActive" runat="server"></asp:CheckBox>
                </td>
            </tr>


            <tr>
                <td style="width: 170px">&nbsp;</td>
                <td>

                    <asp:Button ID="btnSave" runat="server" CssClass="btn btn-success" OnClick="btnSave_Click" Text="Save" Width="90px" />
                    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                    <asp:Button ID="btnCancel" runat="server" CssClass="btn btn-danger" OnClick="btnCancel_Click" Text="Cancel" Width="90px" />

                </td>
            </tr>

        </table>

    </asp:Panel>


</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="Grid" runat="Server">

    <asp:Panel ID="pnlList" runat="server">
        <asp:GridView ID="gridClients" runat="server" AutoGenerateColumns="False" CssClass="resTbl" DataSourceID="DS_tbl_client_details">
            <Columns>
                <asp:BoundField DataField="USER_CODE" HeaderText="User Code" SortExpression="USER_CODE" />
                <asp:BoundField DataField="COMPANY_NAME" HeaderText="Company Name" SortExpression="COMPANY_NAME" />
                <asp:BoundField DataField="COMPANY_ADDRESS" HeaderText="Company Address" SortExpression="COMPANY_ADDRESS" />
                <asp:BoundField DataField="Country" HeaderText="Country" SortExpression="Country" />
                <asp:BoundField DataField="STATE" HeaderText="State" SortExpression="STATE" />
                <asp:BoundField DataField="CITY" HeaderText="City" SortExpression="CITY" />
                <asp:BoundField DataField="POSTAL_CODE" HeaderText="Postal Code" SortExpression="POSTAL_CODE" />
                <asp:BoundField DataField="PRIMARY_TELEPHONE" HeaderText="Primary Telephone" SortExpression="PRIMARY_TELEPHONE" />
                <asp:BoundField DataField="SECONDARY_TELEPHONE" HeaderText="Secondary Telephone" SortExpression="SECONDARY_TELEPHONE" />

                <asp:BoundField DataField="Email" HeaderText="Email" SortExpression="Email" />
                <asp:BoundField DataField="Agreement_Document" HeaderText="Agreement Document" SortExpression="Agreement_Document" />
                <asp:BoundField DataField="Link_To_ISF" HeaderText="Link ToISF" SortExpression="Link_To_ISF" />
                <asp:BoundField DataField="FAX" HeaderText="FAX" SortExpression="FAX" />
                <asp:BoundField DataField="LinkedIn_ID" HeaderText="LinkedIn ID" SortExpression="LinkedIn_ID" />
                <asp:BoundField DataField="Skype_ID" HeaderText="Skype ID" SortExpression="Skype_ID" />
                <asp:BoundField DataField="VAT_Tax_ID" HeaderText="VAT Tax ID" SortExpression="VAT_Tax_ID" />

                <asp:BoundField DataField="PRIMARY_MOBILE" HeaderText="Primary Mobile" SortExpression="PRIMARY_MOBILE" />
                <asp:BoundField DataField="SECONDARY_MOBILE" HeaderText="Secondary Mobile" SortExpression="SECONDARY_MOBILE" />
                <asp:BoundField DataField="CREATED_BY" HeaderText="Created By" SortExpression="CREATED_BY" />
                <asp:BoundField DataField="CREATED_DATE" DataFormatString="{0:yyMMdd}" HtmlEncode="false" HeaderText="Created Date" SortExpression="CREATED_DATE" />
                <asp:BoundField DataField="Active" HeaderText="Active" SortExpression="Active" />

                <asp:TemplateField HeaderText="Edit">
                    <ItemTemplate>
                        <asp:LinkButton ID="linkEdit" runat="server" Text="Edit" CommandArgument='<%# Eval("USER_CODE") %>' OnClick="linkEdit_Click"></asp:LinkButton>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Delete">
                    <ItemTemplate>
                        <asp:LinkButton ID="linkDelete" CommandName="delete" runat="server" Text="Delete" OnClientClick="javascript:return confirm('Are you sure you want to delete this record?');" CommandArgument='<%# Eval("USER_CODE") %>' OnClick="linkDelete_Click"></asp:LinkButton>
                    </ItemTemplate>
                </asp:TemplateField>
            </Columns>
        </asp:GridView>
        <asp:ObjectDataSource ID="DS_tbl_client_details" runat="server" SelectMethod="selectAll" DeleteMethod="delete" InsertMethod="insert" UpdateMethod="update" TypeName="DAL_tbl_client_details">
            <DeleteParameters>
                <asp:Parameter Name="USER_CODE" Type="String" />
            </DeleteParameters>
            <InsertParameters>
                <asp:Parameter Name="USER_CODE" Type="String" />
                <asp:Parameter Name="COMPANY_NAME" Type="String" />
                <asp:Parameter Name="COMPANY_ADDRESS" Type="String" />
                <asp:Parameter Name="Country" Type="String" />
                <asp:Parameter Name="STATE" Type="String" />
                <asp:Parameter Name="CITY" Type="String" />
                <asp:Parameter Name="POSTAL_CODE" Type="String" />
                <asp:Parameter Name="PRIMARY_TELEPHONE" Type="String" />
                <asp:Parameter Name="SECONDARY_TELEPHONE" Type="String" />
                <asp:Parameter Name="PRIMARY_MOBILE" Type="String" />
                <asp:Parameter Name="SECONDARY_MOBILE" Type="String" />

                <asp:Parameter Name="Email" Type="String" />
                <asp:Parameter Name="Agreement_Document" Type="String" />
                <asp:Parameter Name="Link_To_ISF" Type="String" />
                <asp:Parameter Name="FAX" Type="String" />
                <asp:Parameter Name="LinkedIn_ID" Type="String" />
                <asp:Parameter Name="Skype_ID" Type="String" />
                <asp:Parameter Name="VAT_Tax_ID" Type="String" />

                <asp:Parameter Name="CREATED_BY" Type="String" />
                <asp:Parameter Name="CREATED_DATE" Type="DateTime" />
                <asp:Parameter Name="Active" Type="Boolean" />
            </InsertParameters>
            <UpdateParameters>
                <asp:Parameter Name="COMPANY_NAME" Type="String" />
                <asp:Parameter Name="COMPANY_ADDRESS" Type="String" />
                <asp:Parameter Name="Country" Type="String" />
                <asp:Parameter Name="STATE" Type="String" />
                <asp:Parameter Name="CITY" Type="String" />
                <asp:Parameter Name="POSTAL_CODE" Type="String" />
                <asp:Parameter Name="PRIMARY_TELEPHONE" Type="String" />
                <asp:Parameter Name="SECONDARY_TELEPHONE" Type="String" />
                <asp:Parameter Name="PRIMARY_MOBILE" Type="String" />
                <asp:Parameter Name="SECONDARY_MOBILE" Type="String" />

                <asp:Parameter Name="Email" Type="String" />
                <asp:Parameter Name="Agreement_Document" Type="String" />
                <asp:Parameter Name="Link_To_ISF" Type="String" />
                <asp:Parameter Name="FAX" Type="String" />
                <asp:Parameter Name="LinkedIn_ID" Type="String" />
                <asp:Parameter Name="Skype_ID" Type="String" />
                <asp:Parameter Name="VAT_Tax_ID" Type="String" />

                <asp:Parameter Name="UPDATED_BY" Type="String" />
                <asp:Parameter Name="UPDATED_DATE" Type="DateTime" />
                <asp:Parameter Name="Active" Type="Boolean" />
            </UpdateParameters>
        </asp:ObjectDataSource>
    </asp:Panel>

</asp:Content>

